package com.atguigu.dao;

import com.atguigu.bean.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author 伟哥
 * @date 2021-05-02 17:31
 */
@Repository
public class EmployeeDao {

    @Autowired
    JdbcTemplate jdbcTemplate;

    /**
     *
     * @param employee 传入的employee，获取它的值，传入sql语句，执行保存数据
     */
    public void save(Employee employee){
        String sql = "INSERT INTO employee(emp_name,salary) VALUES(?,?)";

        jdbcTemplate.update(sql,employee.getEmpName(),employee.getSalary());
    }
}
